package com.hotkid.ceo.jetpack.myjetpackmvvm.ui.register

import androidx.lifecycle.MutableLiveData
import com.hotkid.ceo.jetpack.myjetpackmvvm.base.BaseViewModel
import com.hotkid.ceo.jetpack.myjetpackmvvm.data.bean.User

/**
 * ClassName:RegisterViewModel
 * Package:com.hotkid.ceo.jetpack.myjetpackmvvm.ui.register
 * Description:
 * @date:2021/3/25 11:07 PM
 * @author:774169396@qq.com
 */
class RegisterViewModel:BaseViewModel() {
    private val repository by lazy{RegisterRepository()}
    val registerState=MutableLiveData<Boolean>()

    fun register(username:String,passwrod:String,repassword:String){
        launch(
                block = {
                    val loginData=repository.register(username,passwrod,repassword)
                    registerState.value=0==loginData.code()
                }
        )
    }
}